const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const htmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
module.exports = {
    mode: "development",
    entry: "./src/index.js",
    devtool: 'source-map',
    output: {
        filename: "build.js",
        path: path.resolve(__dirname, "./build"),
    },
    module: {
        rules: [
            {
                test: /\.css$/i,
                // 先用css-loader处理为css，后用style-loader处理（从后往前）
                use: ["style-loader", "css-loader"],
            },
            {
                // 排除下面的文件夹
                test: /\.vue$/,
                exclude: /(node_modules|bower_components)/,
                use: ['vue-loader',"my-loader"]
            },
            {
                test: /.md$/,
                use: ['html-loader', 'markdown-loader']
            }
        ],
    },
    resolveLoader: {
        modules: [
            'node_modules',
            path.resolve(__dirname, 'loaders')
        ]
    },
    plugins: [
        new CleanWebpackPlugin(),
        new htmlWebpackPlugin({
            template: './public/index.html'
        }),
        new VueLoaderPlugin()
    ]
};
